/*
package com.qyb.zx;

import org.apache.pdfbox.pdfparser.PDFParser;
import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.pdmodel.PDPage;
import org.junit.Test;

import javax.imageio.IIOImage;
import javax.imageio.ImageIO;
import javax.imageio.ImageWriter;
import javax.imageio.stream.ImageOutputStream;
import java.awt.image.BufferedImage;
import java.io.*;
import java.util.Iterator;
import java.util.List;

*/
/**
 * <p>
 * 实现功能：
 * <p/>
 *
 * @author 秦有宝
 * @version 1.0.00
 *//*

public class ss {

    @Test
    public void s(){
        String IMG_TYPE_JPG = "jpg";
        String filePath = "D:\\ttt\\电信电子发票201811121004.pdf";
        String savePath = "";
        File file = null;
        InputStream in = null;
        List pages = null;
        int buff = 1024 * 1024;
        PDDocument pdDocument = null;
        try {

            file = new File(filePath);
            if (file.exists()) {
                in = new BufferedInputStream(new FileInputStream(filePath),
                        buff);
                PDFParser parser = new PDFParser(in);
                parser.parse();
                pdDocument = parser.getPDDocument();
                pages = pdDocument.getDocumentCatalog().getAllPages();
                for (int i = 0; i < pages.size(); i++) {
                    PDPage page = (PDPage) pages.get(i);
                    BufferedImage img_temp = page.convertToImage();
                    Iterator iterator = ImageIO
                            .getImageWritersBySuffix(IMG_TYPE_JPG);
                    ImageWriter writer = (ImageWriter) iterator.next();
                    ImageOutputStream imageOut = ImageIO
                            .createImageOutputStream(new FileOutputStream(
                                    new File("D:\\" + 1 + "-"
                                            + i + ".jpg")));
                    writer.setOutput(imageOut);
                    writer.write(new IIOImage(img_temp, null, null));
                }
            }

        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (pdDocument != null) {
                try {
                    pdDocument.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }

        }

    }
}
*/
